using System;
using System.Collections.Generic;
using System.Text;
using System.Threading;
using System.Data.SqlClient;
using System.Data;

namespace SpiderService
{
	public class ConfigThread : ThreadBase
	{
		private static AutoResetEvent s_Signal;
		static ConfigThread()
		{
			s_Signal = new AutoResetEvent(true);
		}

		public static void Set()
		{
			s_Signal.Set();
		}


		protected override void DoWork()
		{
			while (this.started)
			{
				s_Signal.WaitOne(TimeSpan.FromSeconds(Globals.ConfigThreadSleepTime));
				try
				{
					if (this.started)
					{
						ConfigDatas.Init();
					}
				}
				catch (Exception ex)
				{
					Globals.FileLog.WriteError(ex);
				}
			}
		}

		protected override void OnStop()
		{
			Set();
		}
	}
}
